
<?php $baseUrl=Zend_Controller_Front::getInstance()->getBaseUrl(); ?>

        <table width="100%">
            <?php
            for($i=($this->currentPage - 1)*$this->pagesize;$i< $this->currentPage*$this->pagesize;$i++)
            {
                if($i>=count($this->bookInterest))
                        break;
                if($i==0)
                {
                    echo "<tr>";
                }
                else if($i%3==0)
                {
                   echo "</tr>" ;
                   echo "<tr>";
                }
            ?>
                <td>
                    <a href="<?php echo $baseUrl . '/default/book/detail/id/'.$this->bookInterest[$i]["_id"]; ?>">
                        <img src="<?php echo $this->bookInterest[$i]["image"];  ?>" alt="" class="abook"/>
                    </a>
                    <br/>
                    <a href="<?php echo $baseUrl . '/default/book/detail/id/'.$this->bookInterest[$i]["_id"]; ?>">
                    <?php
                        if(strlen($this->bookInterest[$i]["name"])>20)
                        {
                            $pos=strpos($this->bookInterest[$i]["name"], " ", 20);
                            if($pos!=False)
                            {
                                echo substr($this->bookInterest[$i]["name"], 0,$pos+1).'...';
                            }
                            else
                                echo $this->bookInterest[$i]["name"];
                        }
                        else
                            echo $this->bookInterest[$i]["name"];
                    ?>
                    </a><br/>
                    Tác giả:
                    <a>
                    <?php
                        if(strlen($this->bookInterest[$i]["author"])>15)
                        {
                            $pos=strpos($this->bookInterest[$i]["author"], " ", 15);
                            if($pos!=False)
                            {
                                echo substr($this->bookInterest[$i]["author"], 0,$pos+1).'...';
                            }
                            else
                                echo $this->bookInterest[$i]["author"];
                        }
                        else
                            echo $this->bookInterest[$i]["author"];
                    ?>
                    </a><br/>
                     <span class="rating">
                        <?php
                            if($this->bookInterest[$i]["sumrating"]==2)
                                    echo '<img alt="" src="'. $baseUrl .'/images/stars-2-0.gif"/><br/>' ;
                            if($this->bookInterest[$i]["sumrating"]==3)
                                    echo '<img alt="" src="'. $baseUrl .'/images/stars-3-0.gif"/><br/>' ;
                            if($this->bookInterest[$i]["sumrating"]==4)
                                    echo '<img alt="" src="'. $baseUrl .'/images/stars-4-0.gif"/><br/>' ;
                            if($this->bookInterest[$i]["sumrating"]==5)
                                    echo '<img alt="" src="'. $baseUrl .'/images/stars-5-0.gif"/><br/>' ;
                        ?>
                    </span>
                    <?php
                        if((int)$this->bookInterest[$i]["view"] >0)
                        {
                            echo '<span class="view">'.$this->bookInterest[$i]["view"].'  </span>người đã xem<br/>';
                        }
                    ?>
                    <?php
                        if(((int)$this->bookInterest[$i]["saleoff"])>0)
                        {
                            echo "<span class='oldprice'>Giá gốc:".$this->bookInterest[$i]["cost"]." đ</span><br/>";
                            echo "<span class='price'>Giá bán:".($this->bookInterest[$i]["cost"]*(100-$this->bookInterest[$i]["saleoff"])/100)." đ</span>";
                        }
                        else
                            echo "<span class='price'>Giá bán:".$this->bookInterest[$i]["cost"]." đ</span>";
                    ?>
                </td>
            <?php

                if($i== count($this->bookInterest)-1)
                {
                    echo "</tr>";
                }
            ?>
            <?php }?>
        </table>
